<template>
  <div>
    <child v-if="!isEmpty" :fatherMethod="fatherMethod" ref="mychild">
      <!-- <p name="footer">123{{testProps}}</p> -->
      <template v-slot:footer='slotProps'>
        <h1>{{ slotProps.user.lastName }}</h1>
      </template>
    </child>
    <p @click="test()">哈哈哈</p>
  </div>
</template>
<script>
import child from "./child";
export default {
  name: "parent",
  components: { child },
  data() {
    return {
      isEmpty: false
    };
  },
    provide () {  
    return {
      dataInfo: 'h哈哈哈'
    }
  },
  created() {
    this.$on("cartBottomStatus", status => {
      console.log("调用了子组件");
    });
  },
  methods: {
    // cartBottomStatus(status) {
    //     console.log(status)
    //   console.log("调用了子组件");
    // }
    fatherMethod() {
      console.log(456);
    },
    test() {
      console.log(this.$refs.mychild.isSelected);
      this.$refs.mychild.childMethod();
    }
  }
};
</script>
<style>
</style>